fix(i18n): map expected failure codes instead of raw messages - #4641
fix(i18n): map expected failure codes instead of raw messages#4641orangeCatDeveloper wants to merge 2 commits into
Conversation
95b736e to
6efe16e
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
The two surfaces that actually got codes (the management dialog and thread search) trace cleanly, and I verified the CJK guards really were dead (every throw in runtime-host-connections-ipc-main.ts is English, and generalizedErrorMessage returns the fallback rather than the raw text on a miss), but three things should change before merge.
P2: failure codes still have no single authority. The 26-code union is re-declared at the presenter while the producers keep their unions inline in four CLI constructors, and the only link between them is a regex that scrapes CLI source at test time. Details inline on settings-projects-copy.ts.
P3: the PR title reads wider than the change. Only the management dialog and thread search became code-driven. provider-panel-shared.ts and artifact-pane.tsx kept raw-message matching as their main path (the lastTest table keyed on lowercased message text, the connection_stale regex, and the keyword classifier); this PR only removed their CJK passthrough. Worth saying that in the body so a reader does not close out the whole item.
P3: shell-controls-copy.ts still carries search.privacyTitle, search.errorTitle and search.statusRegionLabel, none of which search-modal.tsx references any more (its full set of copy uses is title, placeholder, conversationsLabel, resultsLabel, empty, introduction, unavailable, errorByReason, errorFallback), and that file is the only consumer of getShellControlsCopy(...).search. Since this PR is renovating exactly that block, they can go with it.
P3: reconnectWarning is now effectively a boolean. runtime-host-management-dialog.tsx:142 declares useState() but line 596 can only ever store copy.managementReconnectFailed. Make it a boolean, and type the applyReconnectWarning parameter as DesktopRuntimeHostManagementResult['reconnectError'] instead of re-spelling the shape.
4c546cc to
9147344
Compare
The ratchet already lets a legacy file depend on a validated copy catalog, a shell module, or a public application contract, yet it still counted the import declarations and specifiers of those edges as debt, so the cheapest way to satisfy it was to inline the helper. A validated catalog likewise may only carry bare package runtime imports, yet the closure ratchet priced them, so catalogs could not share a lookup helper. Both edge classes are now free wherever the dependency itself is admitted. Generated-by: Claude Code
Runtime Host management and thread search already carry stable failure codes, so the renderer maps them through locale catalogs with an explicit unknown fallback. The CJK sniffs in the provider and artifact error presenters guarded producers that no longer throw Chinese copy. Generated-by: Claude Code
9147344 to
ce1ac13
Compare
Summary
Five renderer sites still rendered a raw
error.messageor decided what to show by sniffing for CJK characters, so English users saw operator/Host prose verbatim or lost the information. This change removes those locale-dependent paths, and the two surfaces that already carry stable failure codes now render through locale catalogs:settings-projects-copy.ts.@maka/runtime-host/operatornow ownsRuntimeHostServiceErrorCode, and the four CLI error classes reference subsets of that union withExtract<>. The renderer catalog keeps a local mirror because importing the operator type there creates renderer dependency debt; a desktop type test checks assignability in both directions so either list drifting failstsc. The wire remains an open string for operator version skew, andObject.hasOwnsends unknown or inherited-property names such asconstructorto the localized fallback. Raw operator details are retained in diagnostics withconsole.error.SearchErrorReasonthroughshell-controls-copy.ts, usingObject.hasOwnfor the unknown fallback. Search state now carries only{ reason }; both structured failures and thrown errors keep raw detail in diagnostics instead of product copy.provider-panel-shared.tsandartifact-pane.tsxonly lose their dead CJK passthrough guards in this change. Their primary paths still classify raw message text (lastTest,connection_stale, and keyword matching), so they are not yet code-driven.Not changed:
skill-status.tssniffsskill.description, which is third-party SKILL.md data rather than our copy. Showing that data as-is while removing keyword blurbs is a separate product decision.Refs #2672
Verification
AI use
Select exactly one:
Tool(s) and scope: Claude Code — producer tracing, implementation, tests, and this description, under the contributor's direction; the commit carries a
Generated-by: Claude Codetrailer.Checklist